package com.th.apicenter.deduct.controller;

import com.th.apicenter.deduct.dto.DeductListDTO;
import com.th.apicenter.deduct.service.ThDeductService;
import com.th.apicenter.tools.ThResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author kay
 * @date 2025/6/9
 * @TODO
 */
@RestController
@RequestMapping("/deduct")
public class ThDeductController {

    @Autowired
    private ThDeductService thDeductService;


    @GetMapping("/queryTypeAll")
    public ThResult queryTypeAll() {
        return ThResult.success(thDeductService.queryTypeAll());
    }

    @PostMapping("/queryDeductAll")
    public ThResult queryListAll(@RequestBody DeductListDTO deductListDTO) {
        return ThResult.success(thDeductService.queryListAll(deductListDTO));
    }

    @GetMapping("/update")
    public ThResult updateDeduct(@RequestParam(name = "id") String id, @RequestParam(name = "percent") String percent) {
        return ThResult.success(thDeductService.updateDeduct(id, percent));
    }
}
